package com.iap.common.command
{
	import com.iap.common.service.IVectorService;
	import com.iap.admin.signal.VectorRequestSignal;
	import com.iap.common.model.VectorModel;
	
	import org.robotlegs.mvcs.SignalCommand;
	
	public class VectorCommand extends SignalCommand
	{
		[Inject]
		public var service:IVectorService;
		[Inject]
		public var model:VectorModel;
		[Inject]
		public var task:String;
		
		override public function execute():void
		{
			service.task = task;
			switch(task)
			{
				case VectorRequestSignal.GET:
				{
					service.getList();
					break;
				}
				case VectorRequestSignal.SAVE:
				{
					service.save(model);
					break;
				}
				case VectorRequestSignal.DELETE:
				{
					service.remove(model);
					break;
				}
				case VectorRequestSignal.VALID_REMOVE:
				{
					service.validRemove(model);
					break;
				}
			}
		}
	}
}